<template>
<div class="search-add">
    <label for="search" class="label-search">
        <input type="text" id="search" class="inp-search" v-model="searchVal">
        <my-button
            type='search'
            class='search'
            @click.native="search"
        >搜索</my-button>
    </label>
    <!-- 测试使用 -->
    <!-- <slot :val="searchVal"></slot> -->
    <my-button
        type='add'
        link
        :to="{name: 'addUser'}"
    >添加用户</my-button>
</div>
</template>

<script>
export default {
    name: "userSearch",
    data() {
        return {
            searchVal: ""
        }
    },
    methods: {
        search() {
            this.$emit("search-event", this.searchVal)
        }
    }
}
</script>

<style scoped>
.search-add {
    display: flex;
    align-items: center;
    width: 100%;
    height: 50px;
    line-height: 50px;
    white-space: nowrap;
    z-index: 5;
}
.search-add .label-search {
    display: flex;
    height: 30px;
    line-height: 30px;
    margin-right: 12px;
    border: 1px solid #cecece;
    border-radius: 5px;
}
.inp-search {
    height: 26px;
    line-height: 26px;
    padding: 2px 6px;
    border: none;
    outline: none;
    border-radius: 5px 0 0 5px;
    font-size: 18px;
}
.search {
    margin-top: -1px;
    margin-right: -1px;
    border: none;
    border-radius: 0 5px 5px 0;
}
</style>